//
//  UIImage+PK.swift
//  Panku
//
//  Created by mac on 2017/2/7.
//  Copyright © 2017年 Monster. All rights reserved.
//

import UIKit
import Foundation

extension UIImage{
    
    convenience init(fileNamed:String,in BundleNamed:String){
        
        let imagePath =  Bundle.main.resourcePath! + "/" + BundleNamed + "/" + fileNamed
        self.init(contentsOfFile:imagePath)!

    }
    
    //获取png格式data
    func PNGData() -> Data {
        return UIImagePNGRepresentation(self)!
    }
    
    //获取jpg格式data
    func JPGData() -> Data {
        return UIImageJPEGRepresentation(self, 1.0)!
    }
    
}
